package o;

import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
import androidx.annotation.ColorInt;
import androidx.annotation.Dimension;
import androidx.annotation.FloatRange;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;

@RestrictTo({androidx.annotation.RestrictTo.d.LIBRARY_GROUP})
public class art extends Drawable {
    private ColorStateList ʻ;
    @ColorInt
    private int ʼ;
    @ColorInt
    private int ʽ;
    final Paint ˊ = new Paint(1);
    private boolean ˊॱ = true;
    final d ˋ = new d();
    @FloatRange(from = 0.0d, to = 360.0d)
    private float ˋॱ;
    @Dimension
    float ˎ;
    final Rect ˏ = new Rect();
    final RectF ॱ = new RectF();
    @ColorInt
    private int ॱˊ;
    @ColorInt
    private int ॱॱ;
    @ColorInt
    private int ᐝ;

    class d extends ConstantState {
        final /* synthetic */ art ˋ;

        private d(art o_art) {
            this.ˋ = o_art;
        }

        @NonNull
        public Drawable newDrawable() {
            return this.ˋ;
        }

        public int getChangingConfigurations() {
            return 0;
        }
    }

    public art() {
        this.ˊ.setStyle(Style.STROKE);
    }

    @Nullable
    public ConstantState getConstantState() {
        return this.ˋ;
    }

    public void ˋ(@ColorInt int i, @ColorInt int i2, @ColorInt int i3, @ColorInt int i4) {
        this.ʽ = i;
        this.ᐝ = i2;
        this.ʼ = i3;
        this.ॱॱ = i4;
    }

    public void ˊ(@Dimension float f) {
        if (this.ˎ != f) {
            this.ˎ = f;
            this.ˊ.setStrokeWidth(1.3333f * f);
            this.ˊॱ = true;
            invalidateSelf();
        }
    }

    public void draw(Canvas canvas) {
        if (this.ˊॱ) {
            this.ˊ.setShader(ˊ());
            this.ˊॱ = false;
        }
        float strokeWidth = this.ˊ.getStrokeWidth() / 2.0f;
        RectF rectF = this.ॱ;
        copyBounds(this.ˏ);
        rectF.set(this.ˏ);
        rectF.left += strokeWidth;
        rectF.top += strokeWidth;
        rectF.right -= strokeWidth;
        rectF.bottom -= strokeWidth;
        canvas.save();
        canvas.rotate(this.ˋॱ, rectF.centerX(), rectF.centerY());
        canvas.drawOval(rectF, this.ˊ);
        canvas.restore();
    }

    public boolean getPadding(Rect rect) {
        int round = Math.round(this.ˎ);
        rect.set(round, round, round, round);
        return true;
    }

    public void setAlpha(@IntRange(from = 0, to = 255) int i) {
        this.ˊ.setAlpha(i);
        invalidateSelf();
    }

    public void ˏ(ColorStateList colorStateList) {
        if (colorStateList != null) {
            this.ॱˊ = colorStateList.getColorForState(getState(), this.ॱˊ);
        }
        this.ʻ = colorStateList;
        this.ˊॱ = true;
        invalidateSelf();
    }

    public void setColorFilter(ColorFilter colorFilter) {
        this.ˊ.setColorFilter(colorFilter);
        invalidateSelf();
    }

    public int getOpacity() {
        return this.ˎ > 0.0f ? -3 : -2;
    }

    public final void ˎ(float f) {
        if (f != this.ˋॱ) {
            this.ˋॱ = f;
            invalidateSelf();
        }
    }

    protected void onBoundsChange(Rect rect) {
        this.ˊॱ = true;
    }

    public boolean isStateful() {
        return (this.ʻ != null && this.ʻ.isStateful()) || super.isStateful();
    }

    protected boolean onStateChange(int[] iArr) {
        if (this.ʻ != null) {
            int colorForState = this.ʻ.getColorForState(iArr, this.ॱˊ);
            if (colorForState != this.ॱˊ) {
                this.ˊॱ = true;
                this.ॱˊ = colorForState;
            }
        }
        if (this.ˊॱ) {
            invalidateSelf();
        }
        return this.ˊॱ;
    }

    private Shader ˊ() {
        Rect rect = this.ˏ;
        copyBounds(rect);
        float height = this.ˎ / ((float) rect.height());
        return new LinearGradient(0.0f, (float) rect.top, 0.0f, (float) rect.bottom, new int[]{fu.ˎ(this.ʽ, this.ॱˊ), fu.ˎ(this.ᐝ, this.ॱˊ), fu.ˎ(fu.ˋ(this.ᐝ, 0), this.ॱˊ), fu.ˎ(fu.ˋ(this.ॱॱ, 0), this.ॱˊ), fu.ˎ(this.ॱॱ, this.ॱˊ), fu.ˎ(this.ʼ, this.ॱˊ)}, new float[]{0.0f, height, 0.5f, 0.5f, 1.0f - height, 1.0f}, TileMode.CLAMP);
    }
}
